<?php
/**
 * 通用产品模板
 */

/**
 * 注册wowhead的toltips的JS，来对WOW产品进行鼠标提示
 */
Yii::app()->clientScript->registerScriptFile('http://static.wowhead.com/widgets/power.js');
//Yii::app()->clientScript->registerScriptFile('http://d3db.com/static/js/external.js');
$script_info = 'var wowhead_tooltips = { "colorlinks": false, "iconizelinks": false, "renamelinks": false }';
Yii::app()->clientScript->registerScript('wowhead', $script_info, CClientScript::POS_HEAD);

$pModel = new ProductBase;
$pModel->p_game = $model->game_id;
$pModel->p_type = $model->product_model;
$currency = $this->changeCurrency(0);
$this->widget('zii.widgets.grid.CGridView', array(
    'id' => 'sys-admin-grid',
    'dataProvider' => $pModel->getProductsByType(),
    'cssFile' => '',
    'ajaxUpdate' => false,
    'htmlOptions' => array('class' => ''),
    'template' => '{summary}{items}{pager}<div class="clearfix"></div>',
    'itemsCssClass' => 'table table-hover',
    'pagerCssClass' => 'pagination',
    'blankDisplay' => 'Buy',
    'pager' => array(//通过pager设置样式   默认为CLinkPager
        'cssFile' => '',
        'prevPageLabel' => '<<',
        'nextPageLabel' => '>>',
        'header' => '',
        'maxButtonCount' => 8,
        'htmlOptions' => array('class' => 'pull-right'),
    ),
    'columns' => array(
        array(
            'header' => 'Product',
            'name' => 'p_name',
            'type' => 'raw',
            'value' => '$data->zam_number ? CHtml::link($data->p_name, "javascript:void(0)", array("rel" => "item=$data->zam_number")) : $data->p_name',
        ),
        array(
            'header' => 'Price('.$currency['tag'].')',
            'name' => 'p_price',
            'value' => '$data->getCurrencyTag() . $data->defaultProductPrice()',
            'htmlOptions' => array('class' => 'price'),
        ),
        array(
            'type' => 'raw',
            'value' => '$data->createBuyButton()',
            'htmlOptions' => array('width' => '100'),
        )
    ),
));
?>
<hr/>
<?php echo $model->info; ?>